package com.aaa.system.service.impl;

import com.aaa.entity.OperLog;
import com.aaa.system.dao.OperLogDao;
import com.aaa.system.service.OperLogService;
import com.aaa.vo.Result;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.catalina.startup.RealmRuleSet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author JYH
 * @version 1.0
 * @date 2023/2/28 10:10
 */
@Service
public class OperLogserviceImpl extends ServiceImpl<OperLogDao, OperLog> implements OperLogService{

    @Autowired
    private OperLogDao operLogDao;

    @Override
    public Result findAll(Integer currentPage, Integer pageSize, String title) {
        PageHelper.startPage(currentPage,pageSize);
        List<OperLog> operLogs = operLogDao.selectOperLog(title);
        PageInfo<OperLog> pageInfo = new PageInfo<>(operLogs);
        return new Result(2000,"成功",pageInfo);
    }

    @Override
    public Result addOperLog(OperLog operLog) {
        int insert = operLogDao.insert(operLog);
        return new Result(2000,"成功",insert);
    }
}
